package com.junlong0716.enjoylearning.adapter

import com.blankj.utilcode.util.FileUtils
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.junlong0716.enjoylearning.R
import com.junlong0716.enjoylearning.entity.DownloadFileEntity

/**
 *@author: 巴黎没有摩天轮Li
 *@description: 下载列表 适配器
 *@date: Created in 上午10:57 2018/6/23
 *@modified by:
 */
class DownloadFileAdapter(data: ArrayList<DownloadFileEntity>) : BaseMultiItemQuickAdapter<DownloadFileEntity, BaseViewHolder>(data) {

    init {
        addItemType(DownloadFileEntity.DOWNLOAD_FILE_AUDIO, R.layout.item_download_audio)
        addItemType(DownloadFileEntity.DOWNLOAD_FILE_VIDEO, R.layout.item_download_video)

    }

    override fun convert(helper: BaseViewHolder?, item: DownloadFileEntity?) {
        val fileName = FileUtils.getFileNameNoExtension(item!!.file)
        helper!!.setText(R.id.tv_download_name,fileName)
        when (helper.itemViewType) {
            DownloadFileEntity.DOWNLOAD_FILE_AUDIO -> {

            }

            DownloadFileEntity.DOWNLOAD_FILE_VIDEO ->{

            }
            else -> {
            }
        }
    }

}